<@t.plat_body pageid="notices">
<script type="text/javascript" src="${base}/js/plugins/datatables/datatables.min.js"></script>
<script type="text/javascript" src="${base}/js/plugins/datatables/datatables_basic.js"></script>
<style>
    .datatable-header, .datatable-footer{
        padding-top: 0;
    }
    .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{
        padding: 6px;
    }
    .btn-xs, .btn-group-xs>.btn{
        padding: 1px 10px;
    }
</style>
<div class="panel panel-flat">
    <div class="panel-heading">
        <h5 class="panel-title">通知公告</h5>
        <div class="heading-elements">
            <a type="button" class="btn btn-primary" href="${base}/plat/notice/editNotice"><i class="icon-add position-left"></i>添加</a>
        </div>
    </div>

    <table class="table datatable-basic" id="userTable">
    </table>
</div>
<script>
    function delRec(id) {
        createConfirm('您确定要删除该数据',function() {
            post('pl/nt/del?code='+id,function (result) {
                if(result.code==0){
                    table.ajax.reload();
                }else{
                    alertError(result.message);
                }
            });
        });
    }
    var table;
    $(function () {
        table=simpleTable('userTable', [
            {
                sWidth:80,
                dataIndex: 'title',
                title: "标题"
            },
            {
                sWidth:80,
                dataIndex: 'flag',
                title: "是否启用",
                render:function (data) {
                    return (data=='0')?"否":"是";
                }
            },{
                sWidth:140,
                dataIndex: 'startdate',
                title: "启用时间",
                type:'date'
            },{
                sWidth:140,
                dataIndex: 'enddate',
                title: "结束时间",
                type:'date'
            },
            {
                sWidth:200,
                title: "操作",
                dataIndex: 'id',
                sClass:'text-center',
                render: function (data, type, full) {
                    var html = '<div><a style="margin-left: 2px" href="${base}/plat/notice/editNotice?code='+data+'" class="btn btn-success btn-xs btn-outline">编辑</a>';
                    html+='<a href="javascript:void(0)" style="margin-left: 2px" onclick="delRec(\''+data+'\')" class="btn btn-primary btn-xs btn-outline">删除</a>'
                    html+='</div>';
                    return html;
                }
            }
        ], {
            bAutoWidth:false,
            searching: true,
            bLengthChange: false,
            bSort: false,
            url: '${base}/pl/nt/list',
            pageLength: 10

        });
    });
</script>
</@t.plat_body>
